package HomeWork.HomeWork06;

import java.util.ArrayList;

/***/
public class test5 {
    public static void main(String[] args) {

        System.out.println(makeDate_e());



    }
    public static void printAll_s(ArrayList<Student> stuList){
        for (Student student : stuList) {
            System.out.println("姓名:" +student.getName()+
                    "年龄:" +student.getAge()+
                    "性别:"+student.getSex());
        }
    }
    public static void printAll_P(ArrayList<Phone> phones){
        for (Phone phone:phones) {
            System.out.println("品牌:" +phone.getBrand()+
                    "价格:" +phone.getPrice()+
                    "颜色:"+phone.getColor());
        }
    }

    public static ArrayList<Student> makeDate_Stu(){
        ArrayList<Student> stuList = new ArrayList<Student>();
        stuList.add(new Student("张三",18,"男"));
        stuList.add(new Student("李四",40,"女"));
        stuList.add(new Student("王五",27,"男"));
        return stuList;
    }


    public static ArrayList<Phone> makeDate_Phone(){
        ArrayList<Phone> phones = new ArrayList<>();
        phones.add(new Phone("小米",1999,"红色"));
        phones.add(new Phone("华为",2999,"黄色"));
        phones.add(new Phone("乐视",3999,"灰色"));
        phones.add(new Phone("奇酷",4999,"黑色"));

        return phones;
    }

    public static ArrayList<Employee> makeDate_e(){
        ArrayList<Employee> employees = new ArrayList<>();
        employees.add(new Employee("张三",1,8000));
        employees.add(new Employee("李四",2,9000));
        employees.add(new Employee("王五",3,10000));

        return employees;
    }


    public static ArrayList<Student> findMax(ArrayList<Student> stuList){
        printAll_s(stuList);
        System.out.println("====================");
        int maxIndex = 0;
        for (int i = 1; i < stuList.size(); i++) {
            if (stuList.get(i).getAge()>stuList.get(maxIndex).getAge()){
                maxIndex=i;
            }
        }
        stuList.get(maxIndex).setName("葫芦娃");
        printAll_s(stuList);
        return stuList;
    }

    public static void printAll(ArrayList<Object> obj){
        obj.toString();

    }

}
